﻿using System;
using System.Collections;
using System.Data;
using CE.Database;

/// <summary>
/// Summary description for ExpediaHotelDB
/// </summary>
/// 
namespace CE.Expedia
{
    public class ExpediaHotelDB
    {
        public ExpediaHotelDB()
        {
            //
            // TODO: Add constructor logic here
            //
        }

        public Int64 Insert(ExpediaHotelInfo expediahotel)
        {
            MyDatabase _db = new MyDatabase();
            Int64 _result = -1;
            string _spName = "sprocExpediaHotelInsertSingleItem";

            SortedList _sPara = new SortedList();
            #region Parameter

            _sPara.Add("@City", expediahotel.City);
            _sPara.Add("@StateProvinceCode", expediahotel.StateProvinceCode);
            _sPara.Add("@CountryCode", expediahotel.CountryCode);
            _sPara.Add("@ArrivalDate", expediahotel.ArrivalDate);
            _sPara.Add("@DepartureDate", expediahotel.DepartureDate);
            _sPara.Add("@NoOfRooms", expediahotel.NoOfRooms);
            _sPara.Add("@StarRating", expediahotel.StarRating);
            _sPara.Add("@HotelChain", expediahotel.HotelChain);
            _sPara.Add("@Amenities", expediahotel.Amenities);
            _sPara.Add("@Info1", expediahotel.Info1);

            #endregion

            _result = _db.ExecuteSP(_spName, _sPara);

            return _result;
        }

        public DataTable GetHotelSearchDetails(Int64 HotelSearchId)
        {
            MyDatabase _db = new MyDatabase();
            DataTable _dtResult = new DataTable("HotelList");
            string _spName = "sprocExpediaHotelSearchSelectSingleItem";
            SortedList _sPara = new SortedList();

            #region Parameter
            _sPara.Add("@HotelSearchId", HotelSearchId);
            #endregion

            _dtResult = _db.GetDataTableBySP(_spName, _sPara);
            return _dtResult;
        }
    }
}
